package com.reportes;

import org.achartengine.ChartFactory;
import org.achartengine.GraphicalView;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

public class VentasGenerales extends Activity {
	/**
	 * @see android.app.Activity#onCreate(Bundle)
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ventas);
		// TODO Put your code here
	}
	
	public void anHandler(View view){
		Venta_General venta = new Venta_General();
		venta.obtenerAnuales();
		GraphicalView mChartview;
		LinearLayout layout = (LinearLayout) findViewById(R.id.idpanelgraficoventa);
		mChartview = ChartFactory.getLineChartView(this, venta.getDataset(), venta.getRenders() );
		layout.addView(mChartview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
	}
	
	public void mesHandler(View view){
		Venta_General venta = new Venta_General();
		venta.obtenerMensuales();
		GraphicalView mChartview;
		LinearLayout layout = (LinearLayout) findViewById(R.id.idpanelgraficoventa);
		mChartview = ChartFactory.getLineChartView(this, venta.getDataset(), venta.getRenders() );
		layout.addView(mChartview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
	}
	
	public void trimHandler(View view){
		Venta_General venta = new Venta_General();
		venta.obtenerTrimestrales();
		GraphicalView mChartview;
		LinearLayout layout = (LinearLayout) findViewById(R.id.idpanelgraficoventa);
		mChartview = ChartFactory.getLineChartView(this, venta.getDataset(), venta.getRenders() );
		layout.addView(mChartview, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
	}
}
